<?php $this->load->view('home/layout/header') ?>
<header class="my-head flex">
    <div class="my-return">
        <a href="javascript:history.go(-1);">
            <i class="iconfont icon-zuojiantou"></i>
        </a>
    </div>
    <div class="my-name">
        首次绑定手机
    </div>
</header>
<section class="mi-proving add-text widthMax">
    <form  action="<?php echo site_url('home/safetycenter/modifyMobilePhonePost'); ?>" method="post" class="sms-form">
        <ul>
            <li>
                <h6>手机号</h6>
                <div class="add-input">
                    <input type="text" name="mobile_phone" placeholder="请输入手机号">
                </div>
            </li>
            <li>
                <h6>验证码</h6>
                <div class="add-input flex-1">
                    <input type="tel" name="captcha" placeholder="短信验证码">
                </div>
                <div class="prov-code">
                    <a href="javascript:;" id="safety-sms-captcha" >重发验证码</a>
                </div>
            </li>
        </ul>
        <div class="full-submit">
            <button type="submit">下一步</button>
        </div>
    </form>
</section>
<?php $this->load->view('home/layout/tip'); ?>
<?php $this->load->view('home/layout/footer'); ?>
<script type="text/javascript">
    $('form.sms-form').on('click', '.full-submit button', function (e) {
        var obj = $(this);
        var mobile_phone = $('[name=mobile_phone]').val();
        var captcha      = $('[name=captcha]').val();
        $.ajax({
            type: 'post',
            async: false,
            dataType: 'json',
            url: hostUrl() + 'safetycenter/modifyMobilePhonePost',
            data: {mobile_phone: mobile_phone, captcha: captcha},
            beforeSend: function () {
                obj.attr('disabled', true);
            },
            success: function (json) {
                if (json.status) {
                    window.location.href = json.msg;
                } else {
                    alertMessage(json.msg);
                    obj.removeAttr('disabled');
                }
            }
        });
        return false;
    });
</script>
